#!/usr/bin/env python

import pil2d
import cairo2d

CANVAS_CONTEXT = {
    'cairo' : {
        '2d' : cairo2d.CanvasRenderingContext2D
    },
    'pil' : {
        '2d' : pil2d.CanvasRenderingContext2D
    }
}

__all__ = ['create']

def create(id, canvas, impl='cairo'):
    clazz = CANVAS_CONTEXT.get(impl, {}).get(id, None)

    return clazz(canvas) if clazz else None